package main.java.rock.acm.dp;

import java.util.Scanner;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class Main9 {
    public static void main(String[] args) {


        Lock reentrantLock = new ReentrantLock();
        reentrantLock.lock();
        reentrantLock.unlock();

        Scanner scan = new Scanner(System.in);

        String line = scan.nextLine();
        int[] array_int = new int[line.split(",").length];

        for (int i = 0; i < line.split(",").length; i++) {
            array_int[i] = Integer.valueOf(line.split(",")[i]);
        }


        int temp = array_int[0];
        int limit = 0;

        //是否有波峰或者波谷
        boolean is_have_point = false;

        if(array_int.length<2){
            System.out.println(array_int[0]);
            return;
        }

        if(array_int.length==2){
            System.out.println(Math.abs(array_int[1] - array_int[0]));
            return;
        }



        //假设array_int[i-1]是波峰或者波谷
        for (int i = 2; i < array_int.length; i++) {
            if(array_int[i-2] - array_int[i-1] <=0 && array_int[i-1] - array_int[i] >=0 || array_int[i-2] - array_int[i-1] >=0 && array_int[i-1] - array_int[i] <=0){
                limit = Math.max(Math.abs(array_int[i-1] - temp),limit);
                temp = array_int[i-1];

                //如果进入到这里说明有波峰波谷
                is_have_point = true;
            }

        }

        //如果没有波峰波谷 直接输出最后一个和第一个的差值
        if(!is_have_point){
            System.out.println(Math.abs(array_int[array_int.length-1] - array_int[0]));
        }else {
            System.out.println(limit);
        }
    }

}
